package com.siyuanren.gcocp.enums.wx;

import lombok.Getter;
import org.apache.commons.lang3.StringUtils;

import java.util.Objects;

/**
 * 模版消息任务通知Task类型
 *
 * @author guwr
 */
@Getter
public enum TemplateTypeEnum {
    STUDENT_NOTICE("学员通知", 1, "Q7WTBtZs-YhYlVWpuGgUeO_y7bdr_Ud1zsndy1D6sjk"),
    CLASS_REMIND("上课提醒", 2, "Q7WTBtZs-YhYlVWpuGgUeO_y7bdr_Ud1zsndy1D6sjk"),
    PROJECT_PROGRESS_NOTICE("项目进度通知", 3, "Q7WTBtZs-YhYlVWpuGgUeO_y7bdr_Ud1zsndy1D6sjk");
    private String desc;
    private int value;
    private String templateId;


    TemplateTypeEnum(String desc, int value, String templateId) {
        this.desc = desc;
        this.value = value;
        this.templateId = templateId;
    }

    public static TemplateTypeEnum getModel(int value) {
        for (TemplateTypeEnum he : TemplateTypeEnum.values()) {
            if (Objects.equals(value, he.getValue())) {
                return he;
            }
        }
        return null;
    }

    public static String getEnumDesc(Integer value) {
        if (value == null) {
            return StringUtils.EMPTY;
        }
        TemplateTypeEnum model = getModel(value);
        if (model == null) {
            return StringUtils.EMPTY;
        }
        return model.getDesc();
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    public void setValue(int value) {
        this.value = value;
    }
}